package cn.com.nes.site.service.crm.order;

import cn.com.nes.mybatis.agent.ope.entity.SalePriceMaster;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.bo.crm.sale.CopySalePriceMasterBO;
import cn.com.nes.site.entity.vo.crm.SalePriceMasterVO;
import cn.com.nes.site.entity.vo.crm.sale.MarkSaleOrderDispatchedVO;
import cn.com.nes.site.entity.vo.workOrder.UpdatePriceDetailVO;
import cn.com.nes.site.service.crm.order.bo.CancelPriceMasterBO;
import cn.com.nes.site.service.crm.order.bo.QuerySalePriceMasterBO;
import cn.com.nes.site.service.crm.order.bo.SaleMasterBO;
import cn.com.nes.site.service.crm.order.dto.SalePriceMasterDTO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ShenWei
 * @Date: 2024/03/15/14:18
 */
public interface SalePriceService extends IService<SalePriceMaster> {
    PageData getPriceSheetList(SalePriceMasterVO vo);

    PageData getPriceSheetDetail(SalePriceMasterVO vo);

    SalePriceMasterDTO getPriceSheetDetail(Long id);

    PageData addPriceSheet(SalePriceMasterVO vo) throws Exception;

    @Deprecated
    PageData copyPriceSheet(SalePriceMasterVO vo);

    PageData delPriceSheet(SalePriceMasterVO vo);

    /**
     * 给报价单加标记，被标记的报价单不能修改和删除
     */
    void signPriceSheet(List<Long> priceSheetIdList,Long orderId, Long userId,boolean commit) throws Exception;

    /**
     * 重载接口 - 给系统单加标记,标识已派发安装工单和未派发
     */
    Boolean signPriceSheet(MarkSaleOrderDispatchedVO vo);

    /**
     * 批量撤销安装工单，修改系统单的派单状态
     */
    void cancelPriceMaster(CancelPriceMasterBO cancelPriceMasterBO);

    List<Long> getPriceSheetIdListByOrderId(Long orderId);

    PageData getHistoryName(SalePriceMasterVO vo);

    /**
     * 复制订单价格主表
     * @param copySalePriceMasterBo
     * @throws Exception
     */
    void copySalePriceMaster(CopySalePriceMasterBO copySalePriceMasterBo) throws Exception;

    List<SalePriceMasterDTO> getPriceMastersAndDetails(Long saleOrderId) throws Exception;

    void updatePriceDetail(UpdatePriceDetailVO vo) throws Exception;

    /**
     * 更改派单状态
     * @param priceMasterId  id
     * @param flag  true-改为已派单 false-改为未派单
     */
    void changeStatus(Long priceMasterId, Boolean flag);

    /**
     * 查询有系统单是已派单状态的销售订单id列表
     */
    List<Long> getNotCancelSaleOrderIdList(List<Long> saleOrderIdList);

    SalePriceMasterDTO saveMasterOrder(SaleMasterBO saleMasterBO) throws Exception;

    SalePriceMaster getPriceMaster(Long saleOrderId, String saleMasterName)throws Exception;

    List<SalePriceMasterDTO> getPriceMasterList(QuerySalePriceMasterBO queryBO);

    Integer queryHaveWorkOrder(Set<Long> saleOrderIdSet);
}
